import Router from 'vue-router'
import routes from './routes'

export default () => {
  return new Router({
    routes,
    // base: '/app/',
    mode: 'history',
    linkActiveClass: 'active-class',
    linkExactActiveClass: 'exact-active-link',
    scrollBehavior (to, from, savedPosition) {
      // 记录滚动行为的位置
      if (savedPosition) {
        return savedPosition
      } else {
        return { x: 0, y: 0 }
      }
    },
    fallback: true
    // string转obj
    // parseQuery (query) {},
    // obj转string
    // stringifyQuery (obj) {}
  })
}
